package com.beasts.antpage.core.common.dto;

import lombok.Data;

import java.io.Serializable;

/**
 * 响应信息主体
 *
 * @author Locker
 * @date 07/05/2018 3:39 PM
 * @since 1.0
 */
@Data
public class R<T> implements Serializable {

    public static final int NO_LOGIN = -1;

    public static final int SUCCESS = 0;

    public static final int FAIL = 1;

    public static final int NO_PERMISSION = 2;

    private String msg = "success";

    private int code = SUCCESS;

    private T data;

    public R(T data) {
        super();
        this.data = data;
    }

    public R(T data, String msg) {
        super();
        this.data = data;
        this.msg = msg;
    }

    public R(Throwable e) {
        super();
        this.msg = e.getMessage();
        this.code = FAIL;
    }

}
